{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑政策解读</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">标题：</label>
                            <div class="layui-input-block">
                                <input type="text" name="zc_title" lay-verify="required" placeholder="标题" class="layui-input" value="{$zhengce.zc_title}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">标签：</label>
                            <div class="layui-input-block">
                                <input type="text" name="zc_label" placeholder="标签" class="layui-input" value="{$zhengce.zc_label}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">描述：</label>
                            <div class="layui-input-block">
                                <textarea name="zc_describe" class="layui-input" style="height:80px">{$zhengce.zc_describe}</textarea>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">缩略图：</label>
                            <input type="hidden" name="zc_image" id="lay-img" lay-verify="image" value="{$zhengce.zc_image}">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                        <img class="layui-append-img" src="{$zhengce.zc_image}" onerror="this.src='/static/admin/images/no_img.jpg'">
                                    </div>
                                </blockquote>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">详情：</label>
                            <div class="layui-input-block" >
                                <textarea name="zc_content" id="LAY_editor2" placeholder="详情">{$zhengce.zc_content}</textarea>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">分类：</label>
                            <div class="layui-input-block">
                                <select name="zc_type" lay-verify="required" xm-select="select" xm-select-search="" xm-select-radio="" xm-select-search-type="dl">
                                    <option value="" >请选择</option>
                                    {foreach name="type" item="vo"}
                                    <option value="{$vo.zt_id}" {$vo.zt_id==$zhengce.zc_type?'selected':''}>{$vo.zt_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">首页大图：</label>
                            <div class="layui-input-block">
                                <select name="zc_is_big">
                                    <option value="1" {$zhengce.zc_is_big==1?'selected':''}>不是大图</option>
                                    <option value="2" {$zhengce.zc_is_big==2?'selected':''}>大图</option>
                                    <option value="3" {$zhengce.zc_is_big==3?'selected':''}>不显示</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">视频按钮：</label>
                            <div class="layui-input-block">
                                <select name="zc_is_show_video">
                                    <option value="1" {$zhengce.zc_is_show_video==1?'selected':''}>不显示</option>
                                    <option value="2" {$zhengce.zc_is_show_video==2?'selected':''}>显示</option>
                                </select>
                            </div>
                        </div>

                        <input type="hidden" value="{$zc_id}" name="zc_id">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //百度富文本编辑器
    var ue = wk.UEditor({id:"LAY_editor2",cloud:true,uploadimage:'/admin/Upload/ueditorUpload',uploadscrawl:'/admin/Upload/uploadScrawl',uploadfile:'/admin/Upload/ueditorUpload'});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            data.field.zc_content = ue.getContent();
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('zhengceEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('Zhengce/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });

    });
</script>

</body>
</html>
